package com.jwaoo.chat.session.avchat;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.RelativeLayout;

public class MyFloatView extends RelativeLayout {
    private OnKeyDownListener listener;
    public MyFloatView(Context context) {
        super(context);
    }

    public MyFloatView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyFloatView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        listener.onBackKeyClick();
        return super.onKeyDown(keyCode, event);
    }

    public void setOnKeyDownListener(OnKeyDownListener listener){
        this.listener = listener;
    }

    public interface OnKeyDownListener{
        void onBackKeyClick();
    }
}
